package org.jeecg.modules.tencent.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.tencent.util.TencentCallBackConstants;

import java.util.Arrays;

/**
 * @author guoyh
 * @ClassName IMCallbackEnum
 * @Description
 * @since 2020/8/29 00:04
 **/
@Getter
@AllArgsConstructor
public enum IMCallbackEnum {

    GROUP_MSG_PRE(TencentCallBackConstants.GROUP_MSG_PRE,"Group.CallbackBeforeSendMsg","群组消息发送前回调"),
    GROUP_MSG_AFTER(TencentCallBackConstants.GROUP_MSG_AFTER,"Group.CallbackAfterSendMsg","群组消息发送后回调"),
    USER_STATUS(TencentCallBackConstants.USER_STATUS,"State.StateChange","用户状态变更回调"),
    DEFAULT(TencentCallBackConstants.DEFAULT,"default","默认处理类"),
    ;

    private String key;

    private String name;

    private String desc;

    public static IMCallbackEnum getInstance(String name){
        return Arrays.stream(values()).filter(item -> StringUtils.equals(name,item.getName())).findFirst().orElse(DEFAULT);
    }

}
